package edu.gxnu.cetcdemo.controller;

import edu.gxnu.cetcdemo.pojo.TOpening;
import edu.gxnu.cetcdemo.service.TOpeningService;
import edu.gxnu.cetcdemo.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/opening")
public class TOpeningController {
    @Autowired
    private TOpeningService tOpeningService;

    @ApiOperation("浏览检查表接口")
    @GetMapping("")
    public Result queryTOpening(){
        return tOpeningService.queryTOpening();
    }

    @ApiOperation("添加检查表信息接口")
    @PostMapping("")
    public Result addTOpening(@RequestBody TOpening tOpening){
        return tOpeningService.addTOpening(tOpening);
    }

    @ApiOperation("更新检查表信息接口")
    @PutMapping("")
    public Result updateTOpening(@RequestBody TOpening tOpening){
        return tOpeningService.updateTOpening(tOpening);
    }

    @ApiOperation("删除检查表信息接口")
    @DeleteMapping("/{opening_id}")
    public Result delTOpening(@PathVariable long opening_id){
        return tOpeningService.delTOpening(opening_id);
    }
}
